import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class Test {
    public static void main(String[] args) throws UnknownHostException {
       //1.获取InetAddress对象
        InetAddress address=InetAddress.getByName("DESKTOP-EI4LPHQ");
        System.out.println(address);

        String name=address.getHostName();
        System.out.println(name);

        String ip=address.getHostAddress();
        System.out.println(ip);
   }
}
